#include <Arduino.h>
#include <Button.h>

int digitalRead(uint32_t ulPin) {
    PinName pn = digitalPinToPinName(ulPin);
    GPIO_TypeDef *GPIOx = get_GPIO_Port(STM_PORT(pn));
    uint32_t PinMask = STM_LL_GPIO_PIN(pn);
    uint16_t GPIO_Pin = (PinMask >> GPIO_PIN_MASK_POS) & 0x0000FFFFU;    
    return HAL_GPIO_ReadPin(GPIOx, GPIO_Pin);
}

const uint8_t led_pins[8] = {PA1, PA2, PA3, PA4, PA5, PA6, PA7, PA8};
int8_t led_pos = 8;

#define INC_BUTTON_PIN PB1
#define DEC_BUTTON_PIN PB2

#define BUTTON_DETECTION_PERIOD 10

bool inc_button_is_long_pressed = false;
bool dec_button_is_long_pressed = false;

void inc_button_short_press();
void inc_button_long_press();
void inc_button_long_press_precess();

void dec_button_short_press();
void dec_button_long_press();
void dec_button_long_press_precess();

void setup_led();
void setup_button();

void loop_button();

Button inc_button(INC_BUTTON_PIN, inc_button_short_press, inc_button_long_press);
Button dec_button(DEC_BUTTON_PIN, dec_button_short_press, dec_button_long_press);

